//
// Created by root on 01/04/17.
//

#include <Poco/File.h>
#include <Poco/Logger.h>
#include "temp_clean.h"
#include "sys_config.h"

namespace img_svr{
    void CleanImpl::run() {
        string path=_root_path;
        //printf("%s\n",path.c_str());
        path.append("/").append(common::DateTime::DateStrBefore(_before_days)).append(string("/"));
        Poco::File dir(path);
        if(dir.exists()) {
            dir.remove(true);
            CleanTempLog.information("clean dir %s", path);
        }
    }

    void CleanTempFile::Start() {
        _timer.schedule(_clean_impl_ptr,0,3600000);
    }

}